from selenium import webdriver
from selenium.webdriver.common.by import By

from aotumation.base.basepage import BasePage


class LoginPage(BasePage):
    """
    登录页面
    """
    # 页面url
    url = 'https://passport.bilibili.com/login?from_spm_id=333.851.top_bar.login'
    # 页面元素
    username = (By.ID, 'login-username')
    password = (By.ID, 'login-passwd')
    login_btn = (By.CLASS_NAME, 'btn-login')

    # 页面逻辑
    def login(self, usr, pas):
        self.open()
        self.input(self.username, usr)
        self.input(self.password, pas)
        self.click(self.login_btn)

if __name__ == '__main__':
    driver = webdriver.Chrome()
    lp = LoginPage(driver)
    lp.login('1212', 'asdasd')